﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PrinterBudi.Persistence;

namespace PrinterBudi.Desktop
{
    public static class LoginController
    {
        public static bool IsLoginUserSuccess(string phone, string pass)
        {
            try
            {
                PBUser user = PBUserModel.Read(phone);

                if (user.Password == pass)
                    return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return false;
        }

        public static bool IsLoginEmployeeSuccess(string phone, string pass)
        {
            try
            {
                PBEmployee employee = PBEmployeeModel.Read(phone);

                if (employee.Password == pass)
                    return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return false;
        }
    }
}
